package com.xinqi.modules.homework.homework.service;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.mybatis.data.service.BaseService;
import com.xinqi.modules.homework.homework.domain.CourseHomeworkEntity;
import com.xinqi.modules.homework.homework.dto.req.*;
import com.xinqi.modules.homework.homework.dto.rsp.CourseHomeworkResultDTO;
import com.xinqi.modules.stats.assistant.dto.rsp.AssistantTotalResultDTO;
import com.xinqi.modules.stats.assistant.dto.rsp.StudentInfoResultDTO;

import java.util.List;

/**
 * 课程作业配置表服务层
 *
 * @author: system
 * @date: 2023/03/08
 */

public interface CourseHomeworkService extends BaseService<CourseHomeworkEntity> {

    /**
     * 查询 课程栏目作业-分页
     */
    PageInfo<CourseHomeworkResultDTO> page(Param pageable, CourseHomeworkQueryDTO query);

    /**
     * 查询 课程栏目作业-分页-未发布
     */
    PageInfo<CourseHomeworkResultDTO> pageNoRelease(Param pageable, CourseHomeworkQueryDTO query);

    /**
     * 查询 课程栏目作业-分页-已发布
     */
    PageInfo<CourseHomeworkResultDTO> pageRelease(Param pageable, CourseHomeworkQueryDTO query);

    /**
     * 查询 查询课程栏目作业
     */
    List<CourseHomeworkResultDTO> find(CourseHomeworkQueryDTO query);

    /**
     * 查询课程栏目作业-详情根据ID
     */
    CourseHomeworkResultDTO findById(Long id, CourseHomeworkStudentDetailDTO dto);

    /**
     * 查询作业轮数
     *
     * @param id
     * @return
     */
    CourseHomeworkResultDTO findSimpleById(Long id);

    /**
     * 同时生成好几个轮的作业
     *
     * @param dto
     * @return
     */
    Boolean insertBath(CourseHomeworkCreateDTO dto);

    void addRepeatHomeworkList(List<CourseHomeworkEntity> homeworkEntityList, CourseHomeworkEntity entity);

    /**
     * 根据id修改 课程栏目作业数据
     */
    boolean updateById(CourseHomeworkUpdateDTO dto);

    /**
     * 根据id集合删除 课程栏目作业数据
     */
    boolean deleteHomeworkByIds(List<Long> ids);

    /**
     * 根据id一键发布作业
     */
    boolean releaseHomework(CourseHomeworkReleaseDTO dto);

    /**
     * 根据id一键发布作业 V2版本
     */
    boolean releaseHomeworkV2(CourseHomeworkReleaseDTO dto);

    /**
     * 定时发布批量执行
     */
    boolean homeworkTiming();

    /**
     * 作业提交未提交统计
     */
    AssistantTotalResultDTO selectHomeworkTakeTotal(Long contentId, Integer times);

    /**
     * 作业提交未提交学生列表
     */
    List<StudentInfoResultDTO> selectHomeworkTakeStudent(Long contentId, Integer times, Integer status);

    /**
     * 初始化学生作业记录
     */
    void initStudentLog(CourseHomeworkEntity entity);

    void initStudentLogBatch(List<CourseHomeworkEntity> homeworkEntityList, Integer status, Integer taskType);

    /**
     * 作业同步到课程内容汇总表
     */
    void syncContentHomework(List<CourseHomeworkResultDTO> list);
}
